<?php ob_start("ob_gzhandler");?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>

<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

<title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> <?php wp_title(); ?></title>
<meta name="description" content="<?php bloginfo('description');?>" />
<meta name="generator" content="Blogates <?php bloginfo('version'); ?>" />
	<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
	<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
	<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php wp_head(); ?>
</head>
<body>

<div id="wrap">
	<h1><a href="<?php echo get_option('siteurl'); ?>"><?php bloginfo('name'); ?></a></h1>
	<div class="descrip"><?php bloginfo('description'); ?></div>

<div id="flickr">

<?php
if( file_exists( ABSPATH . WPINC . '/rss.php') ) {
	require_once(ABSPATH . WPINC . '/rss.php');
} else {
	require_once(ABSPATH . WPINC . '/rss-functions.php');
}
$flickr_tag = get_option('flickrock');
if (!empty($flickr_tag)){
	$url = 'http://www.flickr.com/services/feeds/photos_public.gne?tags='.$flickr_tag.'&format=rss_200';
	} else {
	$url = 'http://www.flickr.com/services/feeds/photos_public.gne?tags=flowers&format=rss_200';
}
$flickr_tag = get_option('flickrock');
if (!empty($flickr_tag)){
	$rss_url = 'http://www.flickr.com/services/feeds/photos_public.gne?tags='.$flickr_tag.'&format=rss_200';
	} else {
	$rss_url = 'http://www.flickr.com/services/feeds/photos_public.gne?tags=flowers&format=rss_200';
}
$rss = @fetch_rss($rss_url);
$items = array_slice($rss->items, 0, 6);
foreach ( $items as $item ) {
       	 if(preg_match('<img src="([^"]*)" [^/]*/>', $item['description'],$imgUrlMatches)) {
            	$imgurl = $imgUrlMatches[1];
             	$imgurl = str_replace("_m.jpg", "_s.jpg", $imgurl);
           }
	echo '<img alt="flickr Photo" src="'.$imgurl.'" />';
}
?>
</div>
<br />